<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function num1(callback) {
            setTimeout(function() {
                var num = 1;
                callback(num);
            }, 1000)
        }

        function num2(callback, data) {
            setTimeout(function() {
                callback(data + 1);
            }, 2000)
        }

        function num3(callback, data) {
            setTimeout(function() {
                callback(data + 1);
            }, 3000)
        }
        num1(function(data) {
            num2(function(data2) {
                num3(function(data3) {
                    console.log(data3);
                }, data2)
            }, data)
        })
    </script>
</body>

</html>